const parse = (obj) => {
  let json = {};
  for (let key of Object.keys(obj)) {
    if (key !== "_id") {
      // console.log(key)
      json[key] = obj[key];
    }
  }
  return json;
};

const getTime = () => {
  const date = new Date();
  const getFullYear = date.getFullYear();
  const getMonth =
    date.getMonth() + 1 < 10
      ? "0" + (date.getMonth() + 1)
      : date.getMonth() + 1;
  const getDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  const getHours =
    date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  const getMinutes =
    date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  const formatObj = `${getFullYear}-${getMonth}-${getDate} ${getHours}:${getMinutes}`;
  return formatObj;
};
module.exports = {
  parse,
  getTime,
};
